// pages/demo/demo.js
Page({
  data: {
    list: []
  },
  onLoad() {
    wx.showLoading({
      title: '加载中...',
      mask: true
    })
    
    wx.cloud.database().collection('rcsc')
      .orderBy('publishTime', 'asc')
      .get()
      .then(res => {
        console.log(res)
        this.setData({
          list: res.data
        })
      })
      .catch(err => {
        console.log(err)
        wx.showToast({
          title: '加载失败',
          icon: 'none'
        })
      })
      .finally(() => {
        wx.hideLoading()
      })
  },
  goDetail(e) {
    const id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/detail/detail?id=${id}`
    })
  }
})